home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / STAT / TIMER.PAS < prev   
Pascal/Delphi Source File  |  1990-08-05  |  2KB  |  55 lines

  1. program time_demo;
  2.  
  3. uses
  4.    crt,stat;
  5. const
  6.      num12 = 12;                       { number of data points }
  7.      num7  = 5;
  8. var
  9.    x,auto  : single_array_pointer;     { point to dynamic arrays }
  10.    j       : word;
  11.    r,se    : single;
  12.    mean,
  13.    small,y_est,
  14.    large,diff,
  15.    sd      : single;
  16.  
  17. begin
  18. { create dynamic arrays}
  19.      create_single_array(num12,x);   { create x dynamic array }
  20.      create_single_array(num7,auto); { create auto correlation dynamic array }
  21.  
  22. { put data into the arrays}
  23.      x^[1] := 60.0;
  24.      x^[2] := 60.0;
  25.      x^[3] := 90.0;
  26.      x^[4] := 120.0;
  27.      x^[5] := 140.0;
  28.      x^[6] := 130.0;
  29.      x^[7] := 135.0;
  30.      x^[8] := 150.0;
  31.      x^[9] := 145.0;
  32.      x^[10] := 170.0;
  33.      x^[11] := 185.0;
  34.      x^[12] := 160.0;
  35.  
  36. { clear screen and print header}
  37.      clrscr;
  38.      writeln('            mean        sd     small    large     time series example');
  39.      writeln('           ------     ------   ------   ------');
  40. { get some stats }
  41.      elem_stat(num12,x,small,large,mean,sd);
  42.      writeln('x data',mean:10:2,sd:10:2,small:10:2,large:10:2);
  43. { remove the average from data }
  44.      remove_avg(num12,x,mean);
  45. { get more stats }
  46.      elem_stat(num12,x,small,large,mean,sd);
  47.      writeln('x data',mean:10:2,sd:10:2,small:10:2,large:10:2);
  48. { auto correlate the data }
  49.      autocor(num12,x,num7,auto);
  50.      for j := 1 to num7 do
  51.          writeln('lag ',(j-1):3,auto^[j]:10:3);
  52. { moving average data }
  53.      for j := 1 to num12 do
  54.           writeln(movavg(num12,x,2,j):10:3,x^[j]:10:3);
  55. end.